package com.werdior.shiro.utils;

import com.werdior.shiro.entity.User;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;


/**
 * Created by weirdor on 2017/12/25.
 */
public class ShiroUtils {

    public static User getUser() {
        User user=new User();
        BeanUtils.copyProperties( SecurityUtils.getSubject().getPrincipal(),user);
        return user;
    }

    public static Long getUserId() {
        return getUser().getId();
    }
}
